package com.gargi.crimepatrol.main;

import com.sun.lwuit.Form;
import com.sun.lwuit.Graphics;
import com.sun.lwuit.Painter;
import com.sun.lwuit.geom.Rectangle;

public class View extends Form {
	
	private CrimePatrolMidlet m_crimepatrolmidlet;
	
	public View(CrimePatrolMidlet midlet) {
		super();
		
		m_crimepatrolmidlet = midlet;
		
        // Style title bar
        getTitleArea().getStyle().setPadding(0, 0, 0, 0);
        getTitleStyle().setBgPainter(new TitleBgPainter());
        getTitleStyle().setFgColor(0xeeeeee);
        getTitleComponent().getStyle().setPadding(LEFT, 16);
   	}
			
	public void playVideoUrl(String videoUrl) {
		m_crimepatrolmidlet.playVideo(videoUrl);
	}
		
	public CrimePatrolMidlet getMidlet() {
		return m_crimepatrolmidlet;
	}
	
    public int getContentAreaHeight() {
        return getHeight() - getTitleComponent().getHeight() -
            getMenuBar().getHeight();
    }

	
    class TitleBgPainter
    implements Painter {

    public void paint(Graphics g, Rectangle rect) {
        g.fillLinearGradient(0x333333, 0x444444, 0, 0,
            rect.getSize().getWidth(), rect.getSize(). getHeight(), false);
    }
}


}
